package com.example.demo.service;

import com.example.demo.entity.User;
import com.example.demo.dao.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class LoginService implements com.example.demo.dao.LoginService {
    @Autowired
    UserMapper userMapper;

    @Override
    public boolean login(String username, String password) {
        User user = userMapper.getUserByName(username, password);
        if (user == null){
            log.info("用户名密码错误");
            return false;
        }else if (user.getPassword().equals(password)){
            log.info("登录成功");
            return true;
        }else {
            log.info("密码错误");
            return false;
        }
    }
}








